<!-- 模块说明 -->
<template>
  <div id="box">
    <div class="father">
      <el-col :span="5">
      <div class="el-col">
        <div class="icon">
          <i class="iconfont icon-he_39shijuanguanli"></i>
        </div>
        <div>
          <p>试卷总数</p>
          <p style="color: red;">{{homeLists.doExamPaperCount}}</p>
        </div>
      </div>
    </el-col>
    <el-col :span="5">
      <div class="el-col">
        <div class="icon">
          <i class="iconfont icon-weibiaoti-"></i>
        </div>
        <div>
          <p>题目总数</p>
          <p style="color: red;">{{homeLists.questionCount}}</p>
        </div>
      </div>
    </el-col>
    <el-col :span="5">
      <div class="el-col">
        <div class="icon">
          <i class="iconfont icon-keben1"></i>
        </div>
        <div>
          <p>答卷总数</p>
          <p style="color: red;">{{homeLists.doExamPaperCount}}</p>
        </div>
      </div>
    </el-col>
    <el-col :span="5">
      <div class="el-col">
        <div class="icon">
          <i class="iconfont icon-bianji"></i>
        </div>
        <div>
          <p>答题总数</p>
          <p style="color: red;">{{homeLists.doQuestionCount}}</p>
        </div>
      </div>
    </el-col>
    </div>
    <div class="son">
      <h3>用户活跃度</h3>
      <Echart :option="option" :key="option.types" :width="1650"></Echart>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { mothDayDoExamQuestionValue } from "../../api";
import Echart from "./Echart.vue";
import { homeList } from '../../api'
import '../../assets/iconFont/iconfont.css'
let option = ref<any>({});
const getDatas = async () => {
  let res = await mothDayDoExamQuestionValue();
  // console.log(res.data);
  option.value = {
    types: "line",
    xAxis: {
      type: "category",
      data: res.data.map((item: any) => item.id),
    },
    yAxis: {
      type: "value",
    },
    series: [
      {
        data: res.data.map((item: any) => ({
          value: item.num,
          label: {
            show: true,
            // 标签的文字。
            formatter: item.num,
          },
        })),
        type: "line",
      },
    ],
  };
};
onMounted(() => {
  getDatas();
  getHomeList()
});
const homeLists = ref({
  examPaperCount: '',
  questionCount: '',
  doExamPaperCount: '',
  doQuestionCount: ''
})
const getHomeList = async () => {
  let res = await homeList ();
  homeLists.value = res.data[0]
  console.log(homeLists.value);
}
</script>
<style lang="scss" scoped>
#box {
  background-color: #f4f4f4;
  margin: 0 auto;
  width: 100%;
  height: calc(100vh - 60px);
  // border: 1px solid #000;
  box-sizing: border-box;
  overflow: hidden;
  .son {
    width: 1650px;
    background-color: #fff;
    margin: 50px auto;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    h3 {
      margin-top: 30px;
      font-size: 30px;
      text-align: center;
    }
  }
  .icon {
    // width: 80px;
    // height: 80px;
    // line-height: 80px;
    // text-align: center;
    margin-right: 140px;
    i {
      display: block;
      padding: 16px;
    }
  }
  .el-col {
    display: flex;
    font-size: 18px;
    background-color: #fff;
    padding: 5px;
    justify-content: space-between;
    align-items: center;
    cursor:pointer;
    p {
      line-height: 30px;
    }
  }
  .el-col:hover .icon-he_39shijuanguanli {
    background-color: #82ef05;
    border-radius: 5px;
  }
  .el-col:hover .icon-weibiaoti- {
    background-color: #055bef;
    border-radius: 5px;
  }
  .el-col:hover .icon-keben1 {
    background-color: #ef05d8;
    border-radius: 5px;
  }
  .el-col:hover .icon-bianji {
    background-color: #cccc04;
    border-radius: 5px;
  }
  .el-col:hover .iconfont {
    color: #fff;
  }
  ::v-deep .icon-he_39shijuanguanli
   {
    font-size: 56px;
    color: #82ef05;
  }
  ::v-deep .icon-weibiaoti-
   {
    font-size: 56px;
    color: #055bef;
  }
  ::v-deep .icon-keben1
   {
    font-size: 50px;
    color: #ef05d8;
  }
  ::v-deep .icon-bianji
   {
    font-size: 50px;
    color: #cccc04;
  }
}
.father {
  margin-top: 50px;
  display: flex;
  justify-content: space-around;
}
</style>
